<template>
  <div>
    <ex-dialog width="1000px" class="ex-diolog" title="" :visible="visible" @closeDialog="handleClose">
      <Loading></Loading>
      <div class="main">
        <div class="title" style="display: flex;justify-content: flex-start;align-items: center;">
          开通功能： <dict-tag :options="applyFunctionList" :value="info.applyFunction" />
        </div>
        <div class="box">
          <div class="min_title">商户信息</div>
          <div class="info">
            <el-row>
              <el-col :span="12">
                <div class="list">
                  <div class="lable">统一信用社代码：</div>
                  <div class="content">{{ merchantsData.businessLicenseNumber }}</div>
                </div>
              </el-col>
              <el-col :span="12">
                <div class="list">
                  <div class="lable">店铺名称：</div>
                  <div class="content">{{ merchantsData.shopName }}</div>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <div class="list">
                  <div class="lable">企业名称：</div>
                  <div class="content">{{ merchantsData.merchantName }}</div>
                </div>
              </el-col>
              <el-col :span="12">
                <div class="list">
                  <div class="lable">成立日期：</div>
                  <div class="content">{{ merchantsData.businessLicenseStartDate }}</div>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <div class="list">
                  <div class="lable">法人姓名：</div>
                  <div class="content">{{ merchantsData.legalPerson }}</div>
                </div>
              </el-col>
              <el-col :span="12">
                <div class="list">
                  <div class="lable">经营期限：</div>
                  <div class="content">{{ merchantsData.businessLicenseEndDate }}</div>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <div class="list">
                  <div class="lable">法人联系电话：</div>
                  <div class="content">{{ merchantsData.legalPersonPhone }}</div>
                </div>
              </el-col>
              <el-col :span="12" v-if="info.applyFunction == 1">
                <div class="list">
                  <div class="lable">签约手机号：</div>
                  <div class="content">{{ merchantsData.phone }}</div>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <div class="list">
                  <div class="lable">注册地址：</div>
                  <div class="content">{{ merchantsData.address }}</div>
                </div>
              </el-col>
              <el-col :span="12">
                <div class="list">
                  <div class="lable">店铺类型：</div>
                  <div class="content">{{ merchantsData.shopTypeName }}</div>
                </div>
              </el-col>
            </el-row>
            <el-form :inline="true" :rules="rules" :model="formInline" ref="formInline" class="demo-form-inline"
              :disabled="pathType != 'audit'">
              <el-row>
                <el-col :span="12">
                  <div class="list" v-if="info.applyFunction == 2">
                    <div class="lable">企业类别：</div>
                    <div class="content">
                      <dict-tag :options="merchantTypeList" :value="merchantsData.merchantType" />
                    </div>
                  </div>
                  <el-form-item label="企业类别：" prop="merchantType" v-if="info.applyFunction == 1" key="1">
                    <el-select v-model="formInline.merchantType" placeholder="请选择">
                      <el-option v-for="item in merchantTypeList" :key="item.id" :label="item.value"
                        :value="item.id"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <div class="list">
                    <div class="lable">品牌介绍：</div>
                    <div class="content">{{ merchantsData.introduce }}</div>
                  </div>
                </el-col>
              </el-row>

              <el-row>
                <el-col :span="12">
                  <el-form-item label="所属区域：" prop="province" key="2">
                    <!-- el-input表单校验占位用，不显示 -->
                    <el-input v-model="formInline.province" :disabled="true" v-show="false"></el-input>
                    <!--  -->
                    <el-cascader :options="regionOptions" :props="{ value: 'id', label: 'label', children: 'children' }"
                      @change="regionChange" v-model="regionAvalue">
                    </el-cascader>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="注册资金：" prop="registeredFund" v-if="formInline.merchantType == 1" key="3">
                    <el-input v-model="formInline.registeredFund" placeholder="请输入注册资金" @input="checkUnit">
                      <template slot="append" v-if="moneyUnit">{{ moneyUnit }}</template>
                    </el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>

                <el-col :span="12">
                  <el-form-item label="神椰店铺类型：" key="4" v-if="info.applyFunction == 1">
                    <el-select v-model="formInline.shenyeShopType" placeholder="请选择">
                      <el-option v-for="item in shopTypeList" :key="item.id" :label="item.value" :value="item.id">
                      </el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="神椰店铺类型：" prop="shenyeShopType" key="4" v-else-if="info.applyFunction == 2">
                    <el-select v-model="formInline.shenyeShopType" placeholder="请选择">
                      <el-option v-for="item in shopTypeList" :key="item.id" :label="item.value" :value="item.id">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="神椰店铺行业：" key="5" v-if="info.applyFunction == 1">
                    <el-select v-model="formInline.shenyeIndustryId" placeholder="请选择">
                      <el-option v-for="item in shenyeIndustryList" :key="item.id" :label="item.value" :value="item.id">
                      </el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="神椰店铺行业：" prop="shenyeIndustryId" key="5" v-else-if="info.applyFunction == 2">
                    <el-select v-model="formInline.shenyeIndustryId" placeholder="请选择">
                      <el-option v-for="item in shenyeIndustryList" :key="item.id" :label="item.value" :value="item.id">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
            <el-row>
              <el-col :span="12">
                <div class="imgList">
                  <div class="lable">营业执照：</div>
                  <img :src="merchantsData.businessLicenseImg" alt="" v-if="merchantsData.businessLicenseImg"
                    @click="handleFang(merchantsData.businessLicenseImg)">
                </div>
              </el-col>
              <el-col :span="12">
                <div class="imgList">
                  <div class="lable">店铺门头照：</div>
                  <img :src="merchantsData.shopTopImg" alt="" v-if="merchantsData.shopTopImg"
                    @click="handleFang(merchantsData.shopTopImg)">
                </div>
              </el-col>
            </el-row>
            <el-row >
              <el-col :span="12">
                <div class="imgList" style="margin-top: 20px;">
                  <div class="lable">经营者/法人身份信息：</div>
                  <div class="lable_r">
                    <div class="lable_r_box" v-if="merchantsData.manageIdCardFront!=''">
                      <img :src="merchantsData.manageIdCardFront" alt="" @click="handleFang(merchantsData.manageIdCardFront)">
                      <p>身份证正面</p>
                    </div>
                    <div class="lable_r_box" v-if="merchantsData.manageIdCardFront!=''">
                      <img :src="merchantsData.manageIdCardBack" alt="" @click="handleFang(merchantsData.manageIdCardBack)">
                      <p>身份证反面</p>
                    </div>
                  </div>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="20">
                <div class="imgList" style="margin-top: 20px;">
                  <div class="lable">资质信息：</div>
                  <div class="lable_r" v-if="merchantsData.merchantQualificationImgList&&merchantsData.merchantQualificationImgList.length>0">
                    <div v-for="(item,index) in merchantsData.merchantQualificationImgList" :key="index">
                      <img :src="item" alt="" @click="handleFang(item)">
                    </div>
                  </div>
                </div>
              </el-col>
            </el-row>
          </div>

        </div>
        <div class="box">
          <div class="min_title">结算信息</div>
          <!-- 神椰板块 -->
          <template v-if="info.applyFunction == 2">
            <el-form :model="ruleForm" :rules="rules" ref="ruleForm" :disabled="pathType == 'audit' ? false : true"
              :label-width="labelWidth" class="demo-ruleForm">
              <el-form-item label="赚卡服务费" prop="equityFee">
                <el-input v-model="ruleForm.equityFee" placeholder="请输入" :style="{ width: inputWidth }">
                  <template slot="append">%</template>
                </el-input>
              </el-form-item>
              <el-form-item label="结算方式" prop="nfrSettleType">
                <el-select filterable v-model="ruleForm.nfrSettleType" placeholder="请选择" clearable
                  :style="{ width: inputWidth }">
                  <el-option v-for="item in settleBankTypeLs" :key="item.id" :label="item.value" :value="item.id" />
                </el-select>
              </el-form-item>
              <template v-if="ruleForm.nfrSettleType != ''">
                <el-form-item label="开户名称" prop="nfrSettleBankAccountName" key="20">
                  <el-input v-model="ruleForm.nfrSettleBankAccountName" placeholder="请输入"
                    :style="{ width: inputWidth }"></el-input>
                </el-form-item>
                <el-form-item label="银行名称" prop="nfrSettleBank" key="21">
                  <el-input v-model="ruleForm.nfrSettleBank" placeholder="请输入" :style="{ width: inputWidth }"></el-input>
                </el-form-item>
                <el-form-item label="开户行卡号" prop="nfrSettleBankNo" key="22">
                  <el-input v-model="ruleForm.nfrSettleBankNo" placeholder="请输入"
                    :style="{ width: inputWidth }"></el-input>
                </el-form-item>
                <el-form-item label="所属开户行" prop="nfrSettleBankBranch" key="23">
                  <el-input v-model="ruleForm.nfrSettleBankBranch" placeholder="请输入"
                    :style="{ width: inputWidth }"></el-input>
                </el-form-item>
                <el-form-item label="开户许可证" prop="licence" ref="licenceRef" v-if="ruleForm.nfrSettleType == 1" key="24">
                  <ImageUploadMore :limit="1" :fileSize="20" @successImg="getLicenceImg" :value="ruleForm.licence">
                  </ImageUploadMore>
                </el-form-item>
                <el-form-item label="银行预留手机号" prop="nfrSettleBankPhone" v-if="ruleForm.nfrSettleType != 1" key="25">
                  <el-input v-model="ruleForm.nfrSettleBankPhone" placeholder="请输入" maxlength="11"
                    :style="{ width: inputWidth }"></el-input>
                </el-form-item>
                <el-form-item label="银行卡正面" prop="nfrSettleBankImg" ref="nfrSettleBankImgRef"
                  v-if="ruleForm.nfrSettleType != 1" key="26">
                  <ImageUploadMore :limit="1" :fileSize="20" @successImg="getBankImgFrontImg"
                    :value="ruleForm.nfrSettleBankImg">
                  </ImageUploadMore>
                </el-form-item>
                <el-form-item label="银行卡反面" prop="nfrSettleBankImgBack" ref="nfrSettleBankImgBackRef"
                  v-if="ruleForm.nfrSettleType != 1" key="27">
                  <ImageUploadMore :limit="1" :fileSize="20" @successImg="getBankImgBackImg"
                    :value="ruleForm.nfrSettleBankImgBack">
                  </ImageUploadMore>
                </el-form-item>
                <el-form-item label="法人授权函信息" prop="settleAuthorization" ref="settleAuthorizationRef"
                  v-if="ruleForm.nfrSettleType == 3" key="28">
                  <ImageUploadMore :limit="1" :fileSize="20" @successImg="geSettleAuthorizationImg"
                    :value="ruleForm.settleAuthorization">
                  </ImageUploadMore>
                </el-form-item>
              </template>
            </el-form>
          </template>
          <!-- 资金板块 -->
          <template v-if="info.applyFunction == 1">
            <el-row>
              <el-col :span="12">
                <div class="list">
                  <div class="lable">结算方式：</div>
                  <div class="content" v-if="moneyData.settleBankType == 1">对公</div>
                  <div class="content" v-if="moneyData.settleBankType == 2">对法人私卡</div>
                  <div class="content" v-if="moneyData.settleBankType == 3">对非法人私卡</div>
                </div>
                <div class="list">
                  <div class="lable">法人身份信息</div>
                </div>
                <div class="list">
                  <div class="lable">法人姓名：</div>
                  <div class="content">{{ moneyData.legalPerson }}</div>
                </div>
                <div class="list">
                  <div class="lable">法人身份证号：</div>
                  <div class="content">{{ moneyData.legalPersonId }}</div>
                </div>
                <div class="imgList">
                  <div class="imgBox">
                    <img :src="moneyData.frontOfIdCard" alt="" v-if="moneyData.frontOfIdCard"
                      @click="handleFang(moneyData.frontOfIdCard)">
                    <img :src="moneyData.backOfIdCard" alt="" v-if="moneyData.backOfIdCard"
                      @click="handleFang(moneyData.backOfIdCard)">
                  </div>
                </div>
              </el-col>
              <el-col :span="12" v-if="moneyData.settleBankType == 3">
                <div class="list">
                  <div class="lable">收款人身份信息</div>
                </div>
                <div class="list">
                  <div class="lable">收款人姓名：</div>
                  <div class="content">{{ moneyData.fundLegalPerson }}</div>
                </div>
                <div class="list">
                  <div class="lable">收款人身份证号：</div>
                  <div class="content">{{ moneyData.fundLegalPersonId }}</div>
                </div>
                <div class="imgList">
                  <div class="imgBox">
                    <img :src="moneyData.fundFrontOfIdCard" alt="" v-if="moneyData.fundFrontOfIdCard"
                      @click="handleFang(moneyData.fundFrontOfIdCard)">
                    <img :src="moneyData.fundBackOfIdCard" alt="" v-if="moneyData.fundBackOfIdCard"
                      @click="handleFang(moneyData.fundBackOfIdCard)">
                  </div>
                </div>
              </el-col>
              <el-col :span="12" v-if="moneyData.settleBankType == 2">
                <div class="list">
                  <div class="lable">法人银行卡信息</div>
                </div>
                <div class="list">
                  <div class="lable">开户名称：</div>
                  <div class="content">{{ moneyData.settleName }}</div>
                </div>
                <div class="list">
                  <div class="lable">银行名称：</div>
                  <div class="content">{{ moneyData.accountName }}</div>
                </div>
                <div class="list">
                  <div class="lable">开户行卡号：</div>
                  <div class="content">{{ moneyData.accountNo }}</div>
                </div>
                <div class="list">
                  <div class="lable">所属开户支行：</div>
                  <div class="content">{{ moneyData.bankName }}</div>
                </div>
                <div class="imgList">
                  <div class="lable">银行预留手机号：{{ moneyData.bankMobile }}</div>
                  <div class="imgBox">
                    <img :src="moneyData.bankCard" alt="" @click="handleFang(moneyData.bankCard)">
                    <img :src="moneyData.bankCardBack" alt="" @click="handleFang(moneyData.bankCardBack)">
                  </div>
                </div>
              </el-col>
              <el-col :span="12" v-if="moneyData.settleBankType == 1">
                <div class="list">
                  <div class="lable">收款公户信息</div>
                </div>
                <div class="list">
                  <div class="lable">开户名称：</div>
                  <div class="content">{{ moneyData.settleName }}</div>
                </div>
                <div class="list">
                  <div class="lable">银行名称：</div>
                  <div class="content">{{ moneyData.accountName }}</div>
                </div>
                <div class="list">
                  <div class="lable">开户行卡号：</div>
                  <div class="content">{{ moneyData.accountNo }}</div>
                </div>
                <div class="list">
                  <div class="lable">所属开户支行：</div>
                  <div class="content">{{ moneyData.bankName }}</div>
                </div>
                <div class="imgList">
                  <div class="imgBox">
                    <img :src="moneyData.bankCard" alt="" @click="handleFang(moneyData.bankCard)">
                  </div>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12" v-if="moneyData.settleBankType == 3">
                <div class="list">
                  <div class="lable">收款人银行卡信息</div>
                </div>
                <div class="list">
                  <div class="lable">开户名称：</div>
                  <div class="content">{{ moneyData.settleName }}</div>
                </div>
                <div class="list">
                  <div class="lable">银行名称：</div>
                  <div class="content">{{ moneyData.accountName }}</div>
                </div>
                <div class="list">
                  <div class="lable">开户行卡号：</div>
                  <div class="content">{{ moneyData.accountNo }}</div>
                </div>
                <div class="list">
                  <div class="lable">所属开户支行：</div>
                  <div class="content">{{ moneyData.bankName }}</div>
                </div>
                <div class="imgList">
                  <div class="lable">银行预留手机号：{{ moneyData.bankMobile }}</div>
                  <div class="imgBox">
                    <img :src="moneyData.bankCard" alt="" @click="handleFang(moneyData.bankCard)">
                    <img :src="moneyData.bankCardBack" alt="" @click="handleFang(moneyData.bankCardBack)">
                  </div>
                </div>
              </el-col>
              <el-col :span="12" v-if="moneyData.authorization && moneyData.settleBankType == 3">
                <div class="imgList">
                  <div class="lable">法人手持授权函正面照</div>
                  <div class="imgBox" v-if="moneyData.authorization">
                    <img :src="moneyData.authorization" alt="" @click="handleFang(moneyData.authorization)">
                  </div>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12" v-if="formInline.merchantType=='1'&& moneyData.settleBankType == '2'">
                <div class="list">
                  <div class="lable" style="color:#1890ff">备用结算信息</div>
                </div>
                <div class="list">
                  <div class="lable">结算账号：</div>
                  <div class="content">{{ moneyData.standStlAccNo }}</div>
                </div>
                <div class="list">
                  <div class="lable">开户行名称：</div>
                  <div class="content">{{ moneyData.localStandBankName }}</div>
                </div>
                <div class="list">
                  <div class="lable">银行地区：</div>
                  <div class="content">{{ moneyData.standAreaName }}</div>
                </div>
                <div class="list">
                  <div class="lable">所属支行名称：</div>
                  <div class="content">{{ moneyData.localStandBankSubName }}</div>
                </div>
              </el-col>
            </el-row>
          </template>

        </div>
        <div class="btn" v-if="pathType == 'audit'">
          <el-button type="primary" @click="submitFormZj('ruleForm')" v-if="info.applyFunction == 1">同意审核</el-button>
          <el-button type="primary" @click="submitForm('ruleForm')" v-if="info.applyFunction != 1">同意审核</el-button>
          <el-button type="danger" @click="submitRefused">拒绝审核</el-button>
          <!-- <el-button type="primary" @click="handleClose">取消</el-button> -->
        </div>
      </div>

    </ex-dialog>
    <!-- <img-detail-dialog
        v-if="ImgDetailDialog"
        :id="id"
        :imgUrl="urlData"
        :visible.sync="ImgDetailDialog"
      /> -->
    <!-- 拒绝弹窗 -->
    <refusedDialog :id="id" v-if="refusedDialog" :visible.sync="refusedDialog" @success="_handleSuccess" />
  </div>
</template>
<script>
// components
import Loading from '@/components/Loading/index'
// import imgDetailDialog from "./imgDetailDialog";
import refusedDialog from "./refusedDialog"

// api
import {
  industrySelect,
  merchantDetail,
  auditMerchant
} from "@/api/merchants/merchantsAudit";
import {
  getCity
} from "@/api/clientManagement";
export default {
  components: {
    Loading,
    // imgDetailDialog,
    refusedDialog
  },
  props: {
    id: String,
    visible: Boolean,
    pathType: String,
  },
  data() {
    var checkNum = (rule, value, callback) => {
      if (value < 0) {
        return callback(new Error('只可填写数值（0-100），可保留两位小数'));
      } else if (value > 100) {
        return callback(new Error('只可填写数值（0-100），可保留两位小数'));
      } else {
        callback();
      }
    };
    return {
      labelWidth: '120px',
      inputWidth: '280px',
      loading: false,
      refusedDialog: false,
      info: {},
      merchantsData: {},
      moneyData: {},
      merchantTypeList: [],
      moneyUnit: '',//企业资金数
      regionOptions: [], //城市数组
      shopTypeList: [
        { id: '1', value: '平台' },
        // {id: '2', value: '第三方'}
      ],
      settleBankTypeLs: [], //结算方式
      regionAvalue: [],
      shenyeIndustryList: [],//神椰店铺行业列表
      applyFunctionList: [],
      formInline: {
        shenyeShopType: '1',
        shenyeIndustryId: '',
        province: '',
        city: '',
        area: '',
        merchantType: '',
        registeredFund: '',
      },
      urlData: '',
      // ImgDetailDialog: false,
      ruleForm: {
        isSkip: '1',//是否跳过结算信息录入，1跳过，2不跳过
        equityFee: '',//赚卡服务费率
        licence: '',//开户许可证
        nfrSettleBank: '',//nfr结算银行名称
        nfrSettleBankAccountName: '',//nfr结算银行开户名称
        nfrSettleBankBranch: '',//nfr结算银行所属支行
        nfrSettleBankImg: '',//nfr结算银行卡正面
        nfrSettleBankImgBack: '',//nfr结算银行卡背面
        nfrSettleBankNo: '',//nfr结算银行卡号
        nfrSettleBankPhone: '',//nfr结算银行预留手机号
        nfrSettleType: '',//nfr结算类型 manage_settle_bank_type
        settleAuthorization: '',//法人/非法人结算授权书
      },
      rules: {
        province: [{
          required: true,
          message: '请选择区域',
          trigger: 'change'
        }],
        shenyeShopType: [{
          required: true,
          message: '请选择神椰店铺类型',
          trigger: 'change'
        }],
        shenyeIndustryId: [{
          required: true,
          message: '请选择神椰店铺行业',
          trigger: 'change'
        }],
        merchantType: [{
          required: true,
          message: '请选择企业类别',
          trigger: 'change'
        }],
        registeredFund: [{
          required: true,
          message: '请输入注册资金',
          trigger: 'blur'
        }],
        equityFee: [
          { required: true, message: '请输入赚卡服务费', trigger: ['change', 'blur'] },
          {
            pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
            message: '只可填写数值（0-100），可保留两位小数'
          },
          { validator: checkNum }
        ],
        settleBankType: [
          { required: true, message: '请选择', trigger: 'change' }
        ],
        licence: [
          { required: true, message: '请上传开户许可证', trigger: 'change' }
        ],
        nfrSettleBankAccountName: [
          { required: true, message: '请输入开户名称', trigger: ['change', 'blur'] }
        ],
        nfrSettleBank: [
          { required: true, message: '请输入银行名称', trigger: ['change', 'blur'] }
        ],
        nfrSettleBankNo: [
          { required: true, message: '请输入开户行卡号', trigger: ['change', 'blur'] }
        ],
        nfrSettleBankBranch: [
          { required: true, message: '请输入所属开户行', trigger: ['change', 'blur'] }
        ],
        nfrSettleBankPhone: [
          { required: true, message: '请输入银行预留手机号', trigger: ['change', 'blur'] }
        ],
        nfrSettleBankImg: [
          { required: true, message: '请上传银行卡正面', trigger: 'change' }
        ],
        nfrSettleBankImgBack: [
          { required: true, message: '请上传银行卡反面', trigger: 'change' }
        ],
        settleAuthorization: [
          { required: true, message: '请上传法人授权函', trigger: 'change' }
        ],
      },
    }
  },
  computed: {

  },
  created() {
    this.getCity()
    this.getDict()
    this.getIndustrySelect()
    this.getDetail()
  },
  methods: {
    //获取字典
    getDict() {
      console.log("hahahah");
      var dictType = "merchant_merchant_type,merchant_register_apply_function,manage_settle_bank_type";
      this.$getSelectList(dictType)
        .then((res) => {
          this.merchantTypeList = res.result[0].dictList;
          this.applyFunctionList = res.result[1].dictList;
          this.settleBankTypeLs = res.result[2].dictList;
          this.settleBankTypeLs.splice(3, 3);
        })
        .finally(() => {
          this.loading = false;
        });
    },
    getCity() { //查询城市数据
      const params = {};
      getCity(params)
        .then((res) => {
          this.regionOptions = res.result;
          this.regionOptions.forEach((item) => {
            item.children.forEach((items) => {
              items.children.forEach((itemss) => {
                if (itemss.children.length == 0) {
                  itemss.children = null
                }
              })
            })
          })
        })
        .finally(() => { });
    },
    //校验钱数
    checkUnit(val) {
      var unitArr = ['', '', '', '千', '万', '十万', '百万', '千万', '亿']
      if (val.length > 9) {
        this.moneyUnit = unitArr[8]
      } else {
        this.moneyUnit = unitArr[val.length - 1]
      }
    },
    simplifyNum(number) {
      if (!number && number != 0) return '';
      if (number >= 1E3 && number < 1E4) {
        return '千'
      } else if (number >= 1E4 && number < 1E6) {
        return '万'
      } else if (number >= 1E6 && number < 1E7) {
        return '百万'
      } else if (number >= 1E7 && number < 1E8) {
        return '千万'
      } else if (number >= 1E8) {
        return '亿'
      } else { //一千以下
        return ''
      }
    },
    //城市区域选择
    regionChange(value) {
      this.formInline.province = value[0];
      this.formInline.city = value[1];
      this.formInline.area = value[2];
    },
    //获取神椰行业
    getIndustrySelect() {
      var params = {}
      industrySelect(params).then(res => {
        this.shenyeIndustryList = res.result
      })
    },
    //获取开户许可证
    getLicenceImg(e) {
      this.ruleForm.licence = e
      this.$refs['licenceRef'].clearValidate();
    },
    //获取银行卡正面
    getBankImgFrontImg(e) {
      this.ruleForm.nfrSettleBankImg = e
      this.$refs['nfrSettleBankImgRef'].clearValidate();
    },
    //获取银行卡背面
    getBankImgBackImg(e) {
      this.ruleForm.nfrSettleBankImgBack = e
      this.$refs['nfrSettleBankImgBackRef'].clearValidate();
    },
    //获取法人授权涵
    geSettleAuthorizationImg(e) {
      this.ruleForm.settleAuthorization = e
      this.$refs['settleAuthorizationRef'].clearValidate();
    },
    //获取基本信息
    getDetail() {
      this.loading = true
      merchantDetail(this.id).then((res) => {
        const { result } = res;
        this.info = result
        this.merchantsData = result.merchantInfoDTO
        if (this.merchantsData.merchantType == 1 || this.formInline.merchantType == 1) { //类型为企业时不可选择非法人私卡
          this.settleBankTypeLs.splice(2, 1);
        }
        this.moneyData = result.fundInfoDTO
        // this.formInline.shenyeShopType = result.merchantInfoDTO.shenyeShopType
        this.formInline.shenyeShopType = '1'
        this.formInline.shenyeIndustryId = result.merchantInfoDTO.shenyeIndustryId
        this.formInline.province = result.merchantInfoDTO.province
        this.formInline.city = result.merchantInfoDTO.city
        this.formInline.area = result.merchantInfoDTO.area
        this.formInline.merchantType = result.merchantInfoDTO.merchantType
        this.formInline.registeredFund = result.merchantInfoDTO.registeredFund
        //处理所属区域回显
        let regionAvalue = [];
        regionAvalue.push(result.merchantInfoDTO.province);
        regionAvalue.push(result.merchantInfoDTO.city);
        regionAvalue.push(result.merchantInfoDTO.area);
        // regionAvalue.join(",");
        console.log('regionAvalue', regionAvalue)
        this.regionAvalue = regionAvalue;
        // this.$forceUpdate()
        // 结算信息回显
        this.ruleForm.equityFee = result.moduleDetailDTO.equityFee//赚卡服务费率
        this.ruleForm.isSkip = result.moduleDetailDTO.isSkip //是否跳过结算信息录入，1跳过，2不跳过
        this.ruleForm.licence = result.moduleDetailDTO.licence//开户许可证
        this.ruleForm.nfrSettleBank = result.moduleDetailDTO.nfrSettleBank//nfr结算银行名称
        this.ruleForm.nfrSettleBankAccountName = result.moduleDetailDTO.nfrSettleBankAccountName//nfr结算银行开户名称
        this.ruleForm.nfrSettleBankBranch = result.moduleDetailDTO.nfrSettleBankBranch//nfr结算银行所属支行
        this.ruleForm.nfrSettleBankImg = result.moduleDetailDTO.nfrSettleBankImg //nfr结算银行卡正面
        this.ruleForm.nfrSettleBankImgBack = result.moduleDetailDTO.nfrSettleBankImgBack //nfr结算银行卡背面
        this.ruleForm.nfrSettleBankNo = result.moduleDetailDTO.nfrSettleBankNo //nfr结算银行卡号
        this.ruleForm.nfrSettleBankPhone = result.moduleDetailDTO.nfrSettleBankPhone//nfr结算银行预留手机号
        this.ruleForm.nfrSettleType = result.moduleDetailDTO.nfrSettleType//nfr结算类型 manage_settle_bank_type
        this.ruleForm.settleAuthorization = result.moduleDetailDTO.settleAuthorization//法人/非法人结算授权书
        this.loading = false
      });
    },
    handleClose() {
      this.$emit('update:visible', false)
    },
    //放大图片
    handleFang(url) {
      this.urlData = url;
      let routeData = this.$router.resolve({ path: '/merchants/img-show', query: { url: url } });
      window.open(routeData.href, '_blank');
      // this.ImgDetailDialog = true;
    },
    //神椰板块同意
    submitForm(formName) {
      this.$refs['formInline'].validate((valid1) => {
        this.$refs['ruleForm'].validate((valid) => {
          console.log('valid', valid)
          if (valid && valid1) {
            this.$confirm('是否同意?', '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(() => {
              if (this.ruleForm.nfrSettleType == '' || this.ruleForm.nfrSettleType == undefined) {
                this.ruleForm.isSkip = '1'
              } else {
                this.ruleForm.isSkip = '2'
              }
              let data = {
                id: this.id,
                status: 2,
                ...this.formInline,
                ...this.ruleForm
              }
              console.log(data)
              auditMerchant(data).then((res) => {
                if (res.code == 200) {
                  this.$message({
                    type: 'success',
                    message: '操作成功!'
                  });
                  this.$emit('success')
                  this.handleClose()
                }
              }).catch(() => {

              })

            }).catch(() => { });
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      });
    },
    //资金板块确定
    submitFormZj() {
      this.$refs['formInline'].validate((valid) => {
        if (valid) {
          this.$confirm('是否同意?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            if (this.ruleForm.nfrSettleType == '' || this.ruleForm.nfrSettleType == undefined) {
              this.ruleForm.isSkip = '1'
            } else {
              this.ruleForm.isSkip = '2'
            }
            let data = {
              id: this.id,
              status: 2,
              ...this.formInline,
              ...this.ruleForm
            }
            console.log(data)
            auditMerchant(data).then((res) => {
              if (res.code == 200) {
                this.$message({
                  type: 'success',
                  message: '操作成功!'
                });
                this.$emit('success')
                this.handleClose()
              }
            }).catch(() => {

            })

          }).catch(() => { });
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    //拒绝审核
    submitRefused() {
      this.refusedDialog = true
    },
    _handleSuccess() {
      this.$emit('success')
      this.handleClose()
    },
  }
}
</script>
<style lang="scss" scoped>
.ex-diolog {
  ::v-deep .ex--dialog--footer {
    border: none !important;
    padding: 0 !important;
  }

  ::v-deep .ex--dialog--main {
    padding: 10px 20px !important;
  }
}

.main {
  padding: 20px;

  .title {
    font-size: 18px;
    font-weight: 600;
  }

  .min_title {
    font-size: 18px;
    font-weight: 600;
    padding-bottom: 14px;
    border-bottom: 5px solid #f2f2f2;
    margin-bottom: 30px;
  }

  .box {
    margin-top: 30px;
  }

  .info {
    margin-top: 15px;
  }

  .list {
    display: flex;
    justify-content: flex-start;
    // align-items: center;
    margin-bottom: 16px;
    margin-right: 20px;

    .content {
      flex: 1;
      font-size: 14px;
    }
  }

  .lable {
    font-size: 14px;
    font-weight: 700;
  }

  .lable_r {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
  }

  .lable_r_box {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .imgList {
    display: flex;
    flex-direction: column;

    .imgBox {
      display: flex;
      justify-content: flex-start;
      align-items: center;
    }

    img {
      width: 140px;
      height: 80px;
      margin: 20px;
      cursor: pointer;
    }
  }
}

.btn {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 30px;
}

::v-deep .reset-message-box {
  width: 600px !important;
  height: 500px !important;
}

::v-deep .el-message-box__input {
  width: 500px !important;
  height: 200px !important;
}</style>
